#include "GaussianDistribution.h"
#include <iostream>		// cout
#include <vector>                               //std::vectors and std::vectors::iterators
#include <algorithm>		//std::sort
using namespace std;

int main() {
    GaussianDistribution *gd = new GaussianDistribution(0.0, 1.0);
    vector<double> vetor;

    /* coloca 5000 números aleatórios no vetor */
    for (int i = 0; i < 5000; ++i)
        vetor.push_back(gd->Sample());

    delete gd;

    std::sort(vetor.begin(), vetor.end());

    int cauda_esq = 0;
    int cauda_dir = 0;
    int meio = 0;

    double min = 10.0;
    double max = -10.0;

    for (vector<double>::iterator it = vetor.begin(); it != vetor.end(); it++) {
        if (*it < min)
            min = *it;
        if (*it > max)
            max = *it;

        if (*it < -1)
            cauda_esq++;
        else if (*it > 1)
            cauda_dir++;
        else
            meio++;
    }

    cout << "cauda_esq: " << cauda_esq / 5000.0 << "\tmeio: " << meio / 5000.0 << "\tcauda_dir: " << cauda_dir / 5000.0 << endl;
    cout << "\t\tmin: " << min << "\tmax: " << max << endl;

    return 0;
}
